<%--
  Created by IntelliJ IDEA.
  User: hlzhang
  Date: 2018/4/13
  Time: 9:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="ks.po.Kid"%>
<%@page import="ks.po.User"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>客户详细信息页面</title>
    <link href="styles.css" rel="stylesheet" />
    <SCRIPT type="text/javascript">
        function confirmDialog()
        {
            if(confirm("确定要删除该幼儿信息吗?"))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    </SCRIPT>
</head>
<body>
<div>
    <div id="header">
        <%@ include file="inc/header.inc"%>
    </div>
    <div id="main">
        <%
            User user = (User) request.getAttribute("user");
        %>
        <table>
            <tr>
                <td>客户姓名</td>
                <td><input disabled="disabled" value="<%=user.getName()%>" /></td>
            </tr>
            <tr>
                <td>联系电话</td>
                <td><input disabled="disabled" value="<%=user.getTel()%>" /></td>
            </tr>
            <tr>
                <td>家庭地址</td>
                <td><input disabled="disabled" value="<%=user.getAddress()%>" /></td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <%--<a href="KidServlet?m=toAdd&cid=<%=user.getId()%>&cname=<%=URLEncoder.encode(user.getName(), "utf-8")%>">添加新幼儿</a>--%>
                    <%--<input value="返回" type="button" onclick="history.back(-1)"/用history.back不合理，导致如果在添加幼儿页面保存幼儿成功并跳转到本页后，又返回了添加幼儿页面，改为指定跳转到客户查询页 --%>
                    <input value="返回" type="button" onclick="location.href='customersearch.jsp'"/>

                </td>
            </tr>
        </table>
        <%--比较request.getAttribute()和request.getAttribute()的区别--%>
        <h4 align="center" style="color:red"><%=request.getAttribute("msg") == null ? "" : request.getAttribute("msg")%><%=request.getParameter("msg") == null ? "" : request.getParameter("msg")%></h4>
        <hr>
        <table>
            <tr>
                <td colspan="2">幼儿信息</td>
                <%--<td>操作</td>--%>
            </tr>

            <%
                for (Kid kid : user.getKids())
                {
            %>
            <tr>
                <td><img src="<%=kid.getPhoto()%>" width="48px" height="48px"></td>
                <td class="minWidth">姓名:<%=kid.getName()%><br/>生日:<%=kid.getBirthdate()%>
                </td>
                <%--<td class="minWidth">--%>
                    <%--<a href="KidServlet?m=delete&pid=<%=kid.getId()%>&cid=<%=user.getId()%>" onclick=" return confirmDialog();">删除</a>|--%>
                    <%--<a href="TeachingServlet?m=toAdd&customerId=<%=user.getId()%>&kidId=<%=kid.getId()%>&kidName=<%=URLEncoder.encode(kid.getName(), "UTF-8")%>">添加病例</a>|--%>
                    <%--<a href="TeachingServlet?m=showHistory&kidId=<%=kid.getId()%>">浏览病例</a></td>--%>
            </tr>
            <%
                }
            %>

        </table>

    </div>
    <div id="footer">
        <%@ include  file="inc/footer.inc"%>
    </div>
</div>
</body>
</html>
